<!DOCTYPE html>
<html>

<head>
  <title>Quarkus - Funqy Amazon Lambda Binding</title>
  <script id="adobe_dtm" src="https://www.redhat.com/dtm.js" type="text/javascript"></script>
  <script src="/assets/javascript/highlight.pack.js" type="text/javascript"></script>
  <META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'none'; script-src 'self' 'unsafe-eval' 'sha256-ANpuoVzuSex6VhqpYgsG25OHWVA1I+F6aGU04LoI+5s=' 'sha256-ipy9P/3rZZW06mTLAR0EnXvxSNcnfSDPLDuh3kzbB1w=' js.bizographics.com https://www.redhat.com assets.adobedtm.com jsonip.com https://ajax.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://use.fontawesome.com; style-src 'self' https://fonts.googleapis.com https://use.fontawesome.com; img-src 'self' *; media-src 'self' ; frame-src https://www.googletagmanager.com https://www.youtube.com; frame-ancestors 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; font-src 'self' https://use.fontawesome.com https://fonts.gstatic.com;">
  <META HTTP-EQUIV='X-Frame-Options' CONTENT="DENY">
  <META HTTP-EQUIV='X-XSS-Protection' CONTENT="1; mode=block">
  <META HTTP-EQUIV='X-Content-Type-Options' CONTENT="nosniff">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Quarkus: Supersonic Subatomic Java">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@QuarkusIO"> 
  <meta name="twitter:creator" content="@QuarkusIO">
  <meta property="og:url" content="https://quarkus.io/guides/funqy-amazon-lambda" />
  <meta property="og:title" content="Quarkus - Funqy Amazon Lambda Binding" />
  <meta property="og:description" content="Quarkus: Supersonic Subatomic Java" />
  <meta property="og:image" content="/assets/images/quarkus_card.png" />
  <link rel="canonical" href="https://quarkus.io/guides/funqy-amazon-lambda">
  <link rel="shortcut icon" type="image/png" href="/favicon.ico" >
  <link rel="stylesheet" href="https://quarkus.io/guides/stylesheet/config.css" />
  <link rel="stylesheet" href="/assets/css/main.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
  <link rel="alternate" type="application/rss+xml"  href="https://quarkus.io/feed.xml" title="Quarkus">
  <script src="https://quarkus.io/assets/javascript/goan.js" type="text/javascript"></script>
  <script src="https://quarkus.io/assets/javascript/hl.js" type="text/javascript"></script>
</head>

<body class="guides">
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJWS5L"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->

  <div class="nav-wrapper">
  <div class="grid-wrapper">
    <div class="width-12-12">
      <input type="checkbox" id="checkbox" />
      <nav id="main-nav" class="main-nav">
  <div class="container">
    <div class="logo-wrapper">
      
        <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_600px_reverse.png" class="project-logo" title="Quarkus"></a>
      
    </div>
    <label class="nav-toggle" for="checkbox">
      <i class="fa fa-bars"></i>
    </label>
    <div id="menu" class="menu">
      <span>
        <a href="/get-started/" class="">Get Started</a>
      </span>
      <span>
        <a href="/guides/" class="active">Guides</a>
      </span>
      <span>
        <a href="/community/" class="">Community</a>
      </span>
      <span>
        <a href="/support/" class="">Support</a>
      </span>
      <span>
        <a href="/blog/" class="">Blog</a>
      </span>
      <span>
        <a href="https://code.quarkus.io" class="button-cta secondary white">Start Coding</a>
      </span>
    </div>
  </div>
      </nav>
    </div>
  </div>
</div>

  <div class="content">
    <div class="guide">
  <div class="width-12-12">
    <h1 class="text-caps">Quarkus - Funqy Amazon Lambda Binding</h1>
    <div class="hide-mobile toc"><ul class="sectlevel1">
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installing-aws-bits">Installing AWS bits</a></li>
<li><a href="#the-quickstart">The Quickstart</a></li>
<li><a href="#the-code">The Code</a></li>
<li><a href="#choose">Choose Your Function</a></li>
<li><a href="#deploy-to-aws-lambda-java-runtime">Deploy to AWS Lambda Java Runtime</a></li>
<li><a href="#build-and-deploy">Build and Deploy</a></li>
<li><a href="#create-an-execution-role">Create an Execution Role</a></li>
<li><a href="#extra-build-generated-files">Extra Build Generated Files</a></li>
<li><a href="#create-the-function">Create the function</a></li>
<li><a href="#invoke-the-function">Invoke the function</a></li>
<li><a href="#update-the-function">Update the function</a></li>
<li><a href="#deploy-to-aws-lambda-custom-native-runtime">Deploy to AWS Lambda Custom (native) Runtime</a></li>
<li><a href="#examine-the-pom">Examine the POM</a></li>
<li><a href="#integration-testing">Integration Testing</a></li>
<li><a href="#testing-with-the-sam-cli">Testing with the SAM CLI</a></li>
<li><a href="#modifying-function-zip">Modifying <code>function.zip</code></a></li>
<li><a href="#custom-bootstrap-script">Custom <code>bootstrap</code> script</a></li>
</ul></div>
    <div>
      <div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>The guide walks through quickstart code to show you how you can deploy Funqy functions to Amazon Lambda.</p>
</div>
<div class="paragraph">
<p>Funqy functions can be deployed using the AWS Lambda Java Runtime, or you can build a native executable and use
Lambda Custom Runtime if you want a smaller memory footprint and faster cold boot startup time.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>This technology is considered preview.</p>
</div>
<div class="paragraph">
<p>In <em>preview</em>, backward compatibility and presence in the ecosystem is not guaranteed.
Specific improvements might require to change configuration or APIs and plans to become <em>stable</em> are under way.
Feedback is welcome on our <a href="https://groups.google.com/d/forum/quarkus-dev">mailing list</a> or as issues in our <a href="https://github.com/quarkusio/quarkus/issues">GitHub issue tracker</a>.</p>
</div>
<div class="paragraph">
<p>For a full list of possible extension statuses, check our <a href="https://quarkus.io/faq/#extension-status">FAQ entry</a>.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="prerequisites"><a class="anchor" href="#prerequisites"></a>Prerequisites</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To complete this guide, you need:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>less than 30 minutes</p>
</li>
<li>
<p>Read about <a href="funqy">Funqy Basics</a>.  This is a short read!</p>
</li>
<li>
<p>JDK 11 (AWS requires JDK 1.8 or 11)</p>
</li>
<li>
<p>Apache Maven 3.6.2+</p>
</li>
<li>
<p><a href="https://aws.amazon.com">An Amazon AWS account</a></p>
</li>
<li>
<p><a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html">AWS CLI</a></p>
</li>
<li>
<p><a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html">AWS SAM CLI</a>, for local testing</p>
</li>
</ul>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Funqy Amazon Lambdas build off of our <a href="amazon-lambda">Quarkus Amazon Lambda support</a>.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="installing-aws-bits"><a class="anchor" href="#installing-aws-bits"></a>Installing AWS bits</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Installing all the AWS bits is probably the most difficult thing about this guide.  Make sure that you follow all the steps
for installing AWS CLI.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="the-quickstart"><a class="anchor" href="#the-quickstart"></a>The Quickstart</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Clone the Git repository: <code>git clone <a href="https://github.com/quarkusio/quarkus-quickstarts.git" class="bare">https://github.com/quarkusio/quarkus-quickstarts.git</a></code>, or download an <a href="https://github.com/quarkusio/quarkus-quickstarts/archive/master.zip">archive</a>.</p>
</div>
<div class="paragraph">
<p>The solution is located in the <code>funqy-amazon-lambda-quickstart</code> <a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/funqy-quickstarts/funqy-amazon-lambda-quickstart">directory</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="the-code"><a class="anchor" href="#the-code"></a>The Code</h2>
<div class="sectionbody">
<div class="paragraph">
<p>There is nothing special about the code and more importantly nothing AWS specific.  Funqy functions can be deployed to many different
environments and AWS Lambda is one of them.  The Java code is actually the same exact code as the <a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/funqy-quickstarts/funqy-http-quickstart">funqy-http-quickstart</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="choose"><a class="anchor" href="#choose"></a>Choose Your Function</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Only one Funqy function can be exported per Amazon Lambda deployment.  If you have multiple functions defined
within your project, then you will need to choose the function within your Quarkus <code>application.properties</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">quarkus.funqy.export=greet</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can see how the quickstart has done it within its own <a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/funqy-quickstarts/funqy-amazon-lambda-quickstart/src/main/resources/application.properties">application.properties</a>.</p>
</div>
<div class="paragraph">
<p>Alternatively, you can set the <code>QUARKUS_FUNQY_EXPORT</code> environment variable when you create the Amazon Lambda using the <code>aws</code> cli.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="deploy-to-aws-lambda-java-runtime"><a class="anchor" href="#deploy-to-aws-lambda-java-runtime"></a>Deploy to AWS Lambda Java Runtime</h2>
<div class="sectionbody">
<div class="paragraph">
<p>There are a few steps to get your Funqy function running on AWS Lambda.  The quickstart maven project generates a helpful script to
create, update, delete, and invoke your functions for pure Java and native deployments.  This script is generated
at build time.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="build-and-deploy"><a class="anchor" href="#build-and-deploy"></a>Build and Deploy</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Build the project using maven.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">./mvnw clean package</code></pre>
</div>
</div>
<div class="paragraph">
<p>This will compile and package your code.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="create-an-execution-role"><a class="anchor" href="#create-an-execution-role"></a>Create an Execution Role</h2>
<div class="sectionbody">
<div class="paragraph">
<p>View the <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-awscli.html">Getting Started Guide</a> for deploying
a lambda with AWS CLI.  Specifically, make sure you have created an <code>Execution Role</code>.  You will need to define
a <code>LAMBDA_ROLE_ARN</code> environment variable in your profile or console window,  Alternatively, you can edit
the <code>manage.sh</code> script that is generated by the build and put the role value directly there:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">LAMBDA_ROLE_ARN="arn:aws:iam::1234567890:role/lambda-role"</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="extra-build-generated-files"><a class="anchor" href="#extra-build-generated-files"></a>Extra Build Generated Files</h2>
<div class="sectionbody">
<div class="paragraph">
<p>After you run the build, there are a few extra files generated by the <code>quarkus-funqy-amazon-lambda</code> extension.  These files
are in the the build directory:  <code>target/</code> for maven, <code>build/</code> for gradle.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>function.zip</code> - lambda deployment file</p>
</li>
<li>
<p><code>manage.sh</code> - wrapper around aws lambda cli calls</p>
</li>
<li>
<p><code>bootstrap-example.sh</code> - example bootstrap script for native deployments</p>
</li>
<li>
<p><code>sam.jvm.yaml</code> - (optional) for use with sam cli and local testing</p>
</li>
<li>
<p><code>sam.native.yaml</code> - (optional) for use with sam cli and native local testing</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="create-the-function"><a class="anchor" href="#create-the-function"></a>Create the function</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The <code>target/manage.sh</code> script is for managing your Funqy function using the AWS Lambda Java runtime.  This script is provided only for
your convenience. Examine the output of the <code>manage.sh</code> script if you want to learn what aws commands are executed
to create, delete, and update your functions.</p>
</div>
<div class="paragraph">
<p><code>manage.sh</code> supports four operation:  <code>create</code>, <code>delete</code>, <code>update</code>, and <code>invoke</code>.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
To verify your setup, that you have the AWS CLI installed, executed aws configure for the AWS access keys,
and setup the <code>LAMBDA_ROLE_ARN</code> environment variable (as described above), please execute <code>manage.sh</code> without any parameters.
A usage statement will be printed to guide you accordingly.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>To see the <code>usage</code> statement, and validate AWS configuration:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can <code>create</code> your function using the following command:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh create</code></pre>
</div>
</div>
<div class="paragraph">
<p>or if you do not have <code>LAMBDA_ROLE_ARN</code> already defined in this shell:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">LAMBDA_ROLE_ARN="arn:aws:iam::1234567890:role/lambda-role" sh target/manage.sh create</code></pre>
</div>
</div>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
Do not change the handler switch.  This must be hardcoded to <code>io.quarkus.funqy.lambda.FunqyStreamHandler::handleRequest</code>.
This special handler is Funqy&#8217;s integration point with AWS Lambda.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>If there are any problems creating the function, you must delete it with the <code>delete</code> function before re-running
the <code>create</code> command.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh delete</code></pre>
</div>
</div>
<div class="paragraph">
<p>Commands may also be stacked:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh delete create</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="invoke-the-function"><a class="anchor" href="#invoke-the-function"></a>Invoke the function</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Use the <code>invoke</code> command to invoke your function.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh invoke</code></pre>
</div>
</div>
<div class="paragraph">
<p>The example function takes input passed in via the <code>--payload</code> switch which points to a json file
in the root directory of the project.</p>
</div>
<div class="paragraph">
<p>The function can also be invoked locally with the SAM CLI like this:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sam local invoke --template target/sam.jvm.yaml --event payload.json</code></pre>
</div>
</div>
<div class="paragraph">
<p>If you are working with your native image build, simply replace the template name with the native version:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sam local invoke --template target/sam.native.yaml --event payload.json</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="update-the-function"><a class="anchor" href="#update-the-function"></a>Update the function</h2>
<div class="sectionbody">
<div class="paragraph">
<p>You can update the Java code as you see fit.  Once you&#8217;ve rebuilt, you can redeploy your function by executing the
<code>update</code> command.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh update</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="deploy-to-aws-lambda-custom-native-runtime"><a class="anchor" href="#deploy-to-aws-lambda-custom-native-runtime"></a>Deploy to AWS Lambda Custom (native) Runtime</h2>
<div class="sectionbody">
<div class="paragraph">
<p>If you want a lower memory footprint and faster initialization times for your Funqy function, you can compile your Java
code to a native executable.  Just make sure to rebuild your project with the <code>-Pnative</code> switch.</p>
</div>
<div class="paragraph">
<p>For Linux hosts execute:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">mvn package -Pnative</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
If you are building on a non-Linux system, you will need to also pass in a property instructing Quarkus to use a docker build as Amazon
Lambda requires linux binaries.  You can do this by passing this property to your Maven build:
<code>-Dnative-image.docker-build=true</code>, or for Gradle: <code>--docker-build=true</code>.  This requires you to have docker installed locally, however.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">./mvnw clean install -Pnative -Dnative-image.docker-build=true</code></pre>
</div>
</div>
<div class="paragraph">
<p>Either of these commands will compile and create a native executable image.  It also generates a zip file <code>target/function.zip</code>.
This zip file contains your native executable image renamed to <code>bootstrap</code>.  This is a requirement of the AWS Lambda
Custom (Provided) Runtime.</p>
</div>
<div class="paragraph">
<p>The instructions here are exactly as above with one change:  you&#8217;ll need to add <code>native</code> as the first parameter to the
<code>manage.sh</code> script:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sh target/manage.sh native create</code></pre>
</div>
</div>
<div class="paragraph">
<p>As above, commands can be stacked.  The only requirement is that <code>native</code> be the first parameter should you wish
to work with native image builds.  The script will take care of the rest of the details necessary to manage your native
image function deployments.</p>
</div>
<div class="paragraph">
<p>Examine the output of the <code>manage.sh</code> script if you want to learn what aws commands are executed
to create, delete, and update your functions.</p>
</div>
<div class="paragraph">
<p>One thing to note about the create command for native is that the <code>aws lambda create-function</code>
call must set a specific environment variable:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">--environment 'Variables={DISABLE_SIGNAL_HANDLERS=true}'</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="examine-the-pom"><a class="anchor" href="#examine-the-pom"></a>Examine the POM</h2>
<div class="sectionbody">
<div class="paragraph">
<p>There is nothing special about the POM other than the inclusion of the <code>quarkus-funqy-amazon-lambda</code> and <code>quarkus-test-amazon-lambda</code> extensions
as a dependencies.  The extension automatically generates everything you might need for your lambda deployment.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="integration-testing"><a class="anchor" href="#integration-testing"></a>Integration Testing</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Funqy Amazon Lambda support leverages the Quarkus AWS Lambda test framework so that you can unit tests your Funqy functions.
This is true for both JVM and native modes.
This test framework provides similar functionality to the SAM CLI, without the overhead of Docker.</p>
</div>
<div class="paragraph">
<p>If you open up <a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/funqy-quickstarts/funqy-amazon-lambda-quickstart/src/test/java/org/acme/funqy/FunqyTest.java">FunqyTest.java</a>
you&#8217;ll see that the test replicates the AWS execution environment.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.funqy;

import io.quarkus.amazon.lambda.test.LambdaClient;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

@QuarkusTest
public class FunqyTest {
    @Test
    public void testSimpleLambdaSuccess() throws Exception {
        Friend friend = new Friend("Bill");
        Greeting out = LambdaClient.invoke(Greeting.class, friend);
        Assertions.assertEquals("Hello Bill", out.getMessage());
    }
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="testing-with-the-sam-cli"><a class="anchor" href="#testing-with-the-sam-cli"></a>Testing with the SAM CLI</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The <a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html">AWS SAM CLI</a>
allows you to run your functions locally on your laptop in a simulated Lambda environment.  This requires
<a href="https://www.docker.com/products/docker-desktop">docker</a> to be installed.  This is an optional approach should you choose
to take advantage of it.  Otherwise, the Quarkus JUnit integration should be sufficient for most of your needs.</p>
</div>
<div class="paragraph">
<p>A starter template has been generated for both JVM and native execution modes.</p>
</div>
<div class="paragraph">
<p>Run the following SAM CLI command to locally test your function, passing the appropriate SAM <code>template</code>.
The <code>event</code> parameter takes any JSON file, in this case the sample <code>payload.json</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sam local invoke --template target/sam.jvm.yaml --event payload.json</code></pre>
</div>
</div>
<div class="paragraph">
<p>The native image can also be locally tested using the <code>sam.native.yaml</code> template:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">sam local invoke --template target/sam.native.yaml --event payload.json</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="modifying-function-zip"><a class="anchor" href="#modifying-function-zip"></a>Modifying <code>function.zip</code></h2>
<div class="sectionbody">
<div class="paragraph">
<p>The are times where you may have to add additional entries to the <code>function.zip</code> lambda deployment that is generated
by the build.  To do this create a <code>zip.jvm</code> or <code>zip.native</code> directory within <code>src/main</code>.
Create <code>zip.jvm/</code> if you are doing a pure Java.  <code>zip.native/</code> if you are doing a native deployment.</p>
</div>
<div class="paragraph">
<p>Any you files and directories you create under your zip directory will be included within <code>function.zip</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="custom-bootstrap-script"><a class="anchor" href="#custom-bootstrap-script"></a>Custom <code>bootstrap</code> script</h2>
<div class="sectionbody">
<div class="paragraph">
<p>There are times you may want to set specific system properties or other arguments when lambda invokes
your native Funqy deployment.  If you include a <code>bootstrap</code> script file within
<code>zip.native</code>, the Funqy extension will automatically rename the executable to <code>runner</code> within
<code>function.zip</code> and set the unix mode of the <code>bootstrap</code> script to executable.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
The native executable must be referenced as <code>runner</code> if you include a custom <code>bootstrap</code> script.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The extension generates an example script within <code>target/bootstrap-example.sh</code>.</p>
</div>
</div>
</div>
    </div>
  </div>
</div>

  </div>

  <div class="content project-footer">
  <div class="footer-section">
    <div class="logo-wrapper">
      <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_reverse.svg" class="project-logo" title="Quarkus"></a>
    </div>
  </div>
  <div class="grid-wrapper">
    <p class="grid__item width-3-12">Quarkus is open. All dependencies of this project are available under the <a href='https://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache Software License 2.0</a> or compatible license.<br /><br />This website was built with <a href='https://jekyllrb.com/' target='_blank'>Jekyll</a>, is hosted on <a href='https://pages.github.com/' target='_blank'>Github Pages</a> and is completely open source. If you want to make it better, <a href='https://github.com/quarkusio/quarkusio.github.io' target='_blank'>fork the website</a> and show us what you’ve got.</p>

    
      <div class="width-1-12 project-links">
        <span>Navigation</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="/">Home</a></li>
          
            <li><a href="/guides">Guides</a></li>
          
            <li><a href="/community/#contributing">Contribute</a></li>
          
            <li><a href="/faq">FAQ</a></li>
          
            <li><a href="/get-started">Get Started</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Contribute</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://twitter.com/quarkusio">Follow us</a></li>
          
            <li><a href="https://github.com/quarkusio">GitHub</a></li>
          
            <li><a href="/security">Security&nbsp;policy</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Get Help</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://groups.google.com/forum/#!forum/quarkus-dev">Forums</a></li>
          
            <li><a href="https://quarkusio.zulipchat.com">Chatroom</a></li>
          
        </ul>
      </div>
    

    
      <div class="width-3-12 more-links">
        <span>Quarkus is made of community projects</span>
        <ul class="footer-links">
          
            <li><a href="https://vertx.io/" target="_blank">Eclipse Vert.x</a></li>
          
            <li><a href="https://microprofile.io" target="_blank">Eclipse MicroProfile</a></li>
          
            <li><a href="https://hibernate.org" target="_blank">Hibernate</a></li>
          
            <li><a href="https://netty.io" target="_blank">Netty</a></li>
          
            <li><a href="https://resteasy.github.io" target="_blank">RESTEasy</a></li>
          
            <li><a href="https://camel.apache.org" target="_blank">Apache Camel</a></li>
          
            <li><a href="https://code.quarkus.io/" target="_blank">And many more...</a></li>
          
        </ul>
      </div>
    
  </div>
</div>
  <div class="content redhat-footer">
  <div class="grid-wrapper">
    <span class="licence">
      <i class="fab fa-creative-commons"></i><i class="fab fa-creative-commons-by"></i> <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC by 3.0</a> | <a href="https://www.redhat.com/en/about/privacy-policy">Privacy Policy</a>
    </span>
    <span class="redhat">
      Sponsored by
    </span>
    <span class="redhat-logo">
      <a href="https://www.redhat.com/" target="_blank"><img src="/assets/images/redhat_reversed.svg"></a>
    </span>
  </div>
</div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script>
  <script type="text/javascript" src="/assets/javascript/mobile-nav.js"></script>
  <script type="text/javascript" src="/assets/javascript/scroll-down.js"></script>
  <script src="/assets/javascript/satellite.js" type="text/javascript"></script>
  <script src="https://quarkus.io/guides/javascript/config.js" type="text/javascript"></script>
  <script src="/assets/javascript/search-filter.js" type="text/javascript"></script>
  <script src="/assets/javascript/back-to-top.js" type="text/javascript"></script>
</body>

</html>
